// https://uni-helper.js.org/vite-plugin-uni-components
import UniHelperComponents from '@uni-helper/vite-plugin-uni-components'
// https://uni-helper.js.org/vite-plugin-uni-layouts
import UniHelperLayouts from '@uni-helper/vite-plugin-uni-layouts'
// https://github.com/uni-helper/vite-plugin-uni-manifest
import UniHelperManifest from '@uni-helper/vite-plugin-uni-manifest'
// https://github.com/uni-helper/vite-plugin-uni-pages
import UniHelperPages from '@uni-helper/vite-plugin-uni-pages'
// https://uni-helper.js.org/vite-plugin-uni-platform
import UniHelperPlatform from '@uni-helper/vite-plugin-uni-platform'

export default function createUniHelper() {
  return [
    UniHelperPlatform(),
    UniHelperManifest(),
    UniHelperLayouts(),
    UniHelperPages({
      dts: 'src/types/uni-pages.d.ts',
      routeBlockLang: 'yaml',
      /** 不扫描的目录 */
      exclude: [
        '**/components/**/*.*',
        '**/composables/**/*.*',
        '**/static/**/*.*',
        '**/utils/**/*.*',
        '**/uni_modules/**/*.*',
      ],
      /** 扫描的分包目录，例如：src/pages-sub */
      subPackages: [

      ],
    }),
    UniHelperComponents({
      dts: 'src/types/components.d.ts',
      directoryAsNamespace: true, // 开启目录作为命名空间
      collapseSamePrefixes: true, // 折叠相同的前缀
      deep: true, // 深度搜索组件目录
      dirs: [
        'src/components',
        'src/layouts/components',
        // 分包组件
      ],
    }),
  ]
}
